package com.xiyue.lenovo.componentattr;

import android.content.ComponentName;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;

public class SecondActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        EditText show = (EditText) findViewById(R.id.show);
        //获取该Activity对应得Intent的Component属性
        ComponentName comp = getIntent().getComponent();
        //显示ComponentName对象的包名、类名
        show.setText("组件的包名为："+comp.getPackageName()+"\n组件的类名为："+comp.getClassName());
    }
}
